package com.huilian.cloud.framework.common.enums;

import cn.hutool.core.util.ObjUtil;
import com.huilian.cloud.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 通用状态枚举
 *
 * @author 芋道源码
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum implements ArrayValuable<String> {

    ENABLE("0", "开启"),
    DISABLE("1", "关闭");

    public static final String[] ARRAYS = Arrays.stream(values()).map(UserStatusEnum::getStatus).toArray(String[]::new);

    /**
     * 状态值
     */
    private final String status;
    /**
     * 状态名
     */
    private final String name;

    @Override
    public String[] array() {
        return ARRAYS;
    }

    public static boolean isEnable(String status) {
        return ObjUtil.equal(ENABLE.status, status);
    }

    public static boolean isDisable(String status) {
        return ObjUtil.equal(DISABLE.status, status);
    }

}
